/**
 * 旋转双线
 * ibio-develop
 * 2008-11-22 17:42
 */
package com.ibio8.components.wave.behavior{
	import com.ibio8.components.wave.WaveBody;
	
	import flash.display.Sprite;
	import flash.utils.ByteArray;
	
	public class DoubleRotateLine implements IWaveBehavior {
		
		public function show(ba:ByteArray, sp:WaveBody):void {
			//半径，使半径始终等于最长边
			var l:Number = sp.h;
			if (sp.w > sp.h) {
				l = sp.w;
			}
			
			var mc:Sprite = sp.sp1;
			var disp:Number = -l / 2;
			
			mc.graphics.moveTo(disp, 0);
			for (var i:uint = 0; i < 256; i++) {
				var num:Number = -ba.readFloat() * (l / 2);
				mc.graphics.lineTo(i * l / 256 + disp, num);
			}
			mc.rotation += 5;
			
			mc = sp.sp2;
			mc.graphics.moveTo(disp, 0);
			for ( i = 0; i < 256; i++) {
				num = -ba.readFloat() * (l / 2);
				mc.graphics.lineTo(i * l / 256 + disp, num);
			}
			mc.rotation -= 5;
		}
	}
}